home *** CD-ROM | disk | FTP | other *** search
/ Motor Sport Digital Archive Collection 1960s / Motor Sport Digital Archive Collection 1960s.iso / main.swf / scripts / views / Content.as < prev    next >
Encoding:
Text File  |  2008-05-21  |  17.8 KB  |  574 lines

  1. package views
  2. {
  3.    import events.NavigationEvent;
  4.    import flash.accessibility.*;
  5.    import flash.debugger.*;
  6.    import flash.display.*;
  7.    import flash.errors.*;
  8.    import flash.events.*;
  9.    import flash.external.*;
  10.    import flash.filters.*;
  11.    import flash.geom.*;
  12.    import flash.media.*;
  13.    import flash.net.*;
  14.    import flash.printing.*;
  15.    import flash.profiler.*;
  16.    import flash.system.*;
  17.    import flash.text.*;
  18.    import flash.ui.*;
  19.    import flash.utils.*;
  20.    import flash.xml.*;
  21.    import model.PresentationModel;
  22.    import mx.binding.*;
  23.    import mx.containers.Canvas;
  24.    import mx.controls.Image;
  25.    import mx.core.UIComponentDescriptor;
  26.    import mx.core.mx_internal;
  27.    import mx.events.PropertyChangeEvent;
  28.    import mx.styles.*;
  29.    
  30.    public class Content extends Canvas
  31.    {
  32.       private static var _watcherSetupUtil:IWatcherSetupUtil;
  33.       
  34.       private var shadowBottom:Class;
  35.       
  36.       private var _bindings:Array;
  37.       
  38.       [Bindable]
  39.       private var _607087477_Image1:Image;
  40.       
  41.       private var shadowTop:Class;
  42.       
  43.       public var _bindingsByDestination:Object;
  44.       
  45.       [Bindable]
  46.       private var _1559026522browseIssueTab:BrowseIssueTab;
  47.       
  48.       [Bindable]
  49.       private var _1732677141spreadsTab:SpreadsTab;
  50.       
  51.       [Bindable]
  52.       private var _2062164946browseYearTab:BrowseYearTab;
  53.       
  54.       [Bindable]
  55.       private var _607087478_Image2:Image;
  56.       
  57.       [Bindable]
  58.       private var _1778196685searchTab:SearchTab;
  59.       
  60.       public var _bindingsBeginWithWord:Object;
  61.       
  62.       [Bindable]
  63.       private var _3496342read:Read;
  64.       
  65.       [Bindable]
  66.       private var _1857328081presentationModel:PresentationModel;
  67.       
  68.       [Bindable]
  69.       private var _895684237spread:Spread;
  70.       
  71.       private var _watchers:Array;
  72.       
  73.       private var _documentDescriptor_:UIComponentDescriptor;
  74.       
  75.       public function Content()
  76.       {
  77.          _documentDescriptor_ = new UIComponentDescriptor({
  78.             "type":Canvas,
  79.             "propertiesFactory":function():Object
  80.             {
  81.                return {
  82.                   "height":934,
  83.                   "childDescriptors":[new UIComponentDescriptor({
  84.                      "type":Image,
  85.                      "id":"_Image1",
  86.                      "stylesFactory":function():void
  87.                      {
  88.                         this.bottom = 0;
  89.                      }
  90.                   }),new UIComponentDescriptor({
  91.                      "type":Image,
  92.                      "id":"_Image2",
  93.                      "stylesFactory":function():void
  94.                      {
  95.                         this.top = 0;
  96.                      }
  97.                   }),new UIComponentDescriptor({
  98.                      "type":Read,
  99.                      "id":"read",
  100.                      "propertiesFactory":function():Object
  101.                      {
  102.                         return {
  103.                            "x":0,
  104.                            "visible":false
  105.                         };
  106.                      }
  107.                   }),new UIComponentDescriptor({
  108.                      "type":Spread,
  109.                      "id":"spread",
  110.                      "propertiesFactory":function():Object
  111.                      {
  112.                         return {"visible":false};
  113.                      }
  114.                   }),new UIComponentDescriptor({
  115.                      "type":SpreadsTab,
  116.                      "id":"spreadsTab",
  117.                      "stylesFactory":function():void
  118.                      {
  119.                         this.bottom = 0;
  120.                      },
  121.                      "propertiesFactory":function():Object
  122.                      {
  123.                         return {
  124.                            "x":5,
  125.                            "visible":false
  126.                         };
  127.                      }
  128.                   }),new UIComponentDescriptor({
  129.                      "type":SearchTab,
  130.                      "id":"searchTab",
  131.                      "stylesFactory":function():void
  132.                      {
  133.                         this.top = 0;
  134.                      },
  135.                      "propertiesFactory":function():Object
  136.                      {
  137.                         return {
  138.                            "x":5,
  139.                            "visible":false
  140.                         };
  141.                      }
  142.                   }),new UIComponentDescriptor({
  143.                      "type":BrowseYearTab,
  144.                      "id":"browseYearTab",
  145.                      "events":{"yearSelect":"__browseYearTab_yearSelect"},
  146.                      "stylesFactory":function():void
  147.                      {
  148.                         this.horizontalCenter = 6;
  149.                         this.top = 0;
  150.                      },
  151.                      "propertiesFactory":function():Object
  152.                      {
  153.                         return {"visible":false};
  154.                      }
  155.                   }),new UIComponentDescriptor({
  156.                      "type":BrowseIssueTab,
  157.                      "id":"browseIssueTab",
  158.                      "events":{"issueSelect":"__browseIssueTab_issueSelect"},
  159.                      "stylesFactory":function():void
  160.                      {
  161.                         this.horizontalCenter = 6;
  162.                         this.top = 0;
  163.                      },
  164.                      "propertiesFactory":function():Object
  165.                      {
  166.                         return {"visible":false};
  167.                      }
  168.                   })]
  169.                };
  170.             }
  171.          });
  172.          shadowBottom = Content_shadowBottom;
  173.          shadowTop = Content_shadowTop;
  174.          super();
  175.          mx_internal::_document = this;
  176.          this.percentWidth = 100;
  177.          this.height = 934;
  178.          this.horizontalScrollPolicy = "off";
  179.          this.verticalScrollPolicy = "off";
  180.       }
  181.       
  182.       public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
  183.       {
  184.          Content._watcherSetupUtil = param1;
  185.       }
  186.       
  187.       [Bindable(event="propertyChange")]
  188.       public function get browseYearTab() : BrowseYearTab
  189.       {
  190.          return this._2062164946browseYearTab;
  191.       }
  192.       
  193.       public function nextResultHandler(param1:NavigationEvent) : void
  194.       {
  195.          searchTab.nextResult();
  196.       }
  197.       
  198.       public function readMode() : void
  199.       {
  200.          read.visible = true;
  201.          spread.visible = false;
  202.          spreadsTab.visible = false;
  203.          searchTab.visible = false;
  204.       }
  205.       
  206.       public function set browseYearTab(param1:BrowseYearTab) : void
  207.       {
  208.          var _loc2_:Object = null;
  209.          _loc2_ = this._2062164946browseYearTab;
  210.          if(_loc2_ !== param1)
  211.          {
  212.             this._2062164946browseYearTab = param1;
  213.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"browseYearTab",_loc2_,param1));
  214.          }
  215.       }
  216.       
  217.       public function __browseYearTab_yearSelect(param1:NavigationEvent) : void
  218.       {
  219.          yearSelectHandler(param1);
  220.       }
  221.       
  222.       public function set presentationModel(param1:PresentationModel) : void
  223.       {
  224.          var _loc2_:Object = null;
  225.          _loc2_ = this._1857328081presentationModel;
  226.          if(_loc2_ !== param1)
  227.          {
  228.             this._1857328081presentationModel = param1;
  229.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"presentationModel",_loc2_,param1));
  230.          }
  231.       }
  232.       
  233.       public function searchTextChangeHandler(param1:NavigationEvent) : void
  234.       {
  235.          spreadsTab.visible = false;
  236.          searchTab.visible = true;
  237.          searchTab.simpleSearch(param1.eventData as String);
  238.       }
  239.       
  240.       [Bindable(event="propertyChange")]
  241.       public function get browseIssueTab() : BrowseIssueTab
  242.       {
  243.          return this._1559026522browseIssueTab;
  244.       }
  245.       
  246.       [Bindable(event="propertyChange")]
  247.       public function get presentationModel() : PresentationModel
  248.       {
  249.          return this._1857328081presentationModel;
  250.       }
  251.       
  252.       [Bindable(event="propertyChange")]
  253.       public function get searchTab() : SearchTab
  254.       {
  255.          return this._1778196685searchTab;
  256.       }
  257.       
  258.       private function _Content_bindingsSetup() : void
  259.       {
  260.          var binding:Binding = null;
  261.          if(!_bindings)
  262.          {
  263.             _bindings = [];
  264.          }
  265.          if(!_watchers)
  266.          {
  267.             _watchers = [];
  268.          }
  269.          binding = new Binding(this,function():Object
  270.          {
  271.             return shadowBottom;
  272.          },function(param1:Object):void
  273.          {
  274.             _Image1.source = param1;
  275.          },"_Image1.source");
  276.          _bindings[0] = binding;
  277.          binding = new Binding(this,function():Object
  278.          {
  279.             return shadowTop;
  280.          },function(param1:Object):void
  281.          {
  282.             _Image2.source = param1;
  283.          },"_Image2.source");
  284.          _bindings[1] = binding;
  285.          binding = new Binding(this,function():String
  286.          {
  287.             var _loc1_:* = undefined;
  288.             var _loc2_:* = undefined;
  289.             _loc1_ = presentationModel.imageURL;
  290.             return _loc1_ == undefined ? null : String(_loc1_);
  291.          },function(param1:String):void
  292.          {
  293.             read.imageURL = param1;
  294.          },"read.imageURL");
  295.          _bindings[2] = binding;
  296.          binding = new Binding(this,function():String
  297.          {
  298.             var _loc1_:* = undefined;
  299.             var _loc2_:* = undefined;
  300.             _loc1_ = presentationModel.imageURL;
  301.             return _loc1_ == undefined ? null : String(_loc1_);
  302.          },function(param1:String):void
  303.          {
  304.             spread.imageURL = param1;
  305.          },"spread.imageURL");
  306.          _bindings[3] = binding;
  307.          binding = new Binding(this,function():int
  308.          {
  309.             return presentationModel.currentPage;
  310.          },function(param1:int):void
  311.          {
  312.             spread.cover = param1;
  313.          },"spread.cover");
  314.          _bindings[4] = binding;
  315.          binding = new Binding(this,function():PresentationModel
  316.          {
  317.             return presentationModel;
  318.          },function(param1:PresentationModel):void
  319.          {
  320.             spreadsTab.presentationModel = param1;
  321.          },"spreadsTab.presentationModel");
  322.          _bindings[5] = binding;
  323.          binding = new Binding(this,function():PresentationModel
  324.          {
  325.             return presentationModel;
  326.          },function(param1:PresentationModel):void
  327.          {
  328.             searchTab.presentationModel = param1;
  329.          },"searchTab.presentationModel");
  330.          _bindings[6] = binding;
  331.          binding = new Binding(this,function():PresentationModel
  332.          {
  333.             return presentationModel;
  334.          },function(param1:PresentationModel):void
  335.          {
  336.             browseYearTab.presentationModel = param1;
  337.          },"browseYearTab.presentationModel");
  338.          _bindings[7] = binding;
  339.          binding = new Binding(this,function():PresentationModel
  340.          {
  341.             return presentationModel;
  342.          },function(param1:PresentationModel):void
  343.          {
  344.             browseIssueTab.presentationModel = param1;
  345.          },"browseIssueTab.presentationModel");
  346.          _bindings[8] = binding;
  347.       }
  348.       
  349.       public function prevResultHandler(param1:NavigationEvent) : void
  350.       {
  351.          searchTab.prevResult();
  352.       }
  353.       
  354.       public function set spreadsTab(param1:SpreadsTab) : void
  355.       {
  356.          var _loc2_:Object = null;
  357.          _loc2_ = this._1732677141spreadsTab;
  358.          if(_loc2_ !== param1)
  359.          {
  360.             this._1732677141spreadsTab = param1;
  361.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"spreadsTab",_loc2_,param1));
  362.          }
  363.       }
  364.       
  365.       public function __browseIssueTab_issueSelect(param1:NavigationEvent) : void
  366.       {
  367.          issueSelectHandler(param1);
  368.       }
  369.       
  370.       public function set browseIssueTab(param1:BrowseIssueTab) : void
  371.       {
  372.          var _loc2_:Object = null;
  373.          _loc2_ = this._1559026522browseIssueTab;
  374.          if(_loc2_ !== param1)
  375.          {
  376.             this._1559026522browseIssueTab = param1;
  377.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"browseIssueTab",_loc2_,param1));
  378.          }
  379.       }
  380.       
  381.       private function yearSelectHandler(param1:NavigationEvent) : void
  382.       {
  383.          browseYearTab.visible = false;
  384.          browseIssueTab.visible = true;
  385.          dispatchEvent(param1);
  386.       }
  387.       
  388.       [Bindable(event="propertyChange")]
  389.       public function get spread() : Spread
  390.       {
  391.          return this._895684237spread;
  392.       }
  393.       
  394.       [Bindable(event="propertyChange")]
  395.       public function get read() : Read
  396.       {
  397.          return this._3496342read;
  398.       }
  399.       
  400.       public function set searchTab(param1:SearchTab) : void
  401.       {
  402.          var _loc2_:Object = null;
  403.          _loc2_ = this._1778196685searchTab;
  404.          if(_loc2_ !== param1)
  405.          {
  406.             this._1778196685searchTab = param1;
  407.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"searchTab",_loc2_,param1));
  408.          }
  409.       }
  410.       
  411.       public function spreadMode() : void
  412.       {
  413.          read.visible = false;
  414.          spread.visible = true;
  415.       }
  416.       
  417.       public function spreadsTabToggle() : void
  418.       {
  419.          spreadsTab.visible = !spreadsTab.visible;
  420.          if(spreadsTab.visible)
  421.          {
  422.             searchTab.visible = false;
  423.          }
  424.          trace("spreadsTabToggle " + spreadsTab.visible);
  425.       }
  426.       
  427.       public function showSomething() : void
  428.       {
  429.          if(!read.visible)
  430.          {
  431.             if(!spread.visible)
  432.             {
  433.                spreadMode();
  434.             }
  435.          }
  436.       }
  437.       
  438.       [Bindable(event="propertyChange")]
  439.       public function get spreadsTab() : SpreadsTab
  440.       {
  441.          return this._1732677141spreadsTab;
  442.       }
  443.       
  444.       private function issueSelectHandler(param1:NavigationEvent) : void
  445.       {
  446.          browseIssueTab.visible = false;
  447.          dispatchEvent(param1);
  448.       }
  449.       
  450.       public function searchTabToggle() : void
  451.       {
  452.          searchTab.visible = !searchTab.visible;
  453.          if(searchTab.visible)
  454.          {
  455.             spreadsTab.visible = false;
  456.          }
  457.          trace("searchTabToggle " + searchTab.visible);
  458.       }
  459.       
  460.       private function _Content_bindingExprs() : void
  461.       {
  462.          var _loc1_:* = undefined;
  463.          _loc1_ = shadowBottom;
  464.          _loc1_ = shadowTop;
  465.          _loc1_ = presentationModel.imageURL;
  466.          _loc1_ = presentationModel.imageURL;
  467.          _loc1_ = presentationModel.currentPage;
  468.          _loc1_ = presentationModel;
  469.          _loc1_ = presentationModel;
  470.          _loc1_ = presentationModel;
  471.          _loc1_ = presentationModel;
  472.       }
  473.       
  474.       public function browseByCoverToggle() : void
  475.       {
  476.          if(true == browseYearTab.visible || true == browseIssueTab.visible)
  477.          {
  478.             browseYearTab.visible = false;
  479.             browseIssueTab.visible = false;
  480.          }
  481.          else if(1 < presentationModel.years.length)
  482.          {
  483.             browseYearTab.visible = true;
  484.          }
  485.          else
  486.          {
  487.             browseIssueTab.visible = true;
  488.          }
  489.       }
  490.       
  491.       public function set spread(param1:Spread) : void
  492.       {
  493.          var _loc2_:Object = null;
  494.          _loc2_ = this._895684237spread;
  495.          if(_loc2_ !== param1)
  496.          {
  497.             this._895684237spread = param1;
  498.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"spread",_loc2_,param1));
  499.          }
  500.       }
  501.       
  502.       public function set _Image1(param1:Image) : void
  503.       {
  504.          var _loc2_:Object = null;
  505.          _loc2_ = this._607087477_Image1;
  506.          if(_loc2_ !== param1)
  507.          {
  508.             this._607087477_Image1 = param1;
  509.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_Image1",_loc2_,param1));
  510.          }
  511.       }
  512.       
  513.       public function set _Image2(param1:Image) : void
  514.       {
  515.          var _loc2_:Object = null;
  516.          _loc2_ = this._607087478_Image2;
  517.          if(_loc2_ !== param1)
  518.          {
  519.             this._607087478_Image2 = param1;
  520.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_Image2",_loc2_,param1));
  521.          }
  522.       }
  523.       
  524.       public function set read(param1:Read) : void
  525.       {
  526.          var _loc2_:Object = null;
  527.          _loc2_ = this._3496342read;
  528.          if(_loc2_ !== param1)
  529.          {
  530.             this._3496342read = param1;
  531.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"read",_loc2_,param1));
  532.          }
  533.       }
  534.       
  535.       [Bindable(event="propertyChange")]
  536.       public function get _Image2() : Image
  537.       {
  538.          return this._607087478_Image2;
  539.       }
  540.       
  541.       override public function initialize() : void
  542.       {
  543.          var target:Content = null;
  544.          var watcherSetupUtilClass:Object = null;
  545.          mx_internal::setDocumentDescriptor(_documentDescriptor_);
  546.          _Content_bindingsSetup();
  547.          target = this;
  548.          if(_watcherSetupUtil == null)
  549.          {
  550.             watcherSetupUtilClass = getDefinitionByName("_views_ContentWatcherSetupUtil");
  551.             watcherSetupUtilClass["init"](null);
  552.          }
  553.          _watcherSetupUtil.setup(this,function(param1:String):*
  554.          {
  555.             return target[param1];
  556.          },_bindings,_watchers);
  557.          super.initialize();
  558.       }
  559.       
  560.       [Bindable(event="propertyChange")]
  561.       public function get _Image1() : Image
  562.       {
  563.          return this._607087477_Image1;
  564.       }
  565.       
  566.       public function hideTabs() : void
  567.       {
  568.          searchTab.visible = false;
  569.          spreadsTab.visible = false;
  570.       }
  571.    }
  572. }
  573.  
  574.